package thread;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * User: Administrator
 * Date: 2020/12/16
 * Time: 9:37
 * Description:
 */
public class AllowFixThreadsDemo {
    private static ThreadPoolExecutor pool = new ThreadPoolExecutor(10,20,0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(1));
    private static volatile AtomicInteger count = new AtomicInteger(0);
    public static void main(String[] args) throws InterruptedException {
        while (true) {
            try {
                System.out.println("submit时count：" + count.get());
            } catch (Exception e) {
                Thread.sleep(500);
                e.printStackTrace();
            }
        }
    }
}
